package one.SnackGame;

import java.awt.*;

public class GameObj {
    //图片
    Image image;
    //坐标
    int x;
    int y;
    //宽高
    int width = 30;
    int height = 30;

    GameFrame gf;

    //get set方法

    public Image getImage() {
        return image;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public GameFrame getGf() {
        return gf;
    }

    public void setImage(Image image) {
        this.image = image;
    }

    public void setX(int x) {
        this.x = x;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public void setGf(GameFrame gf) {
        this.gf = gf;
    }

    //无参构造
    public GameObj(){

    }
    public GameObj(Image image, int x, int y, GameFrame gf){
        this.image = image;
        this.x = x;
        this.y = y;
        this.gf = gf;
    }

    //构造方法
    public GameObj(Image image, int x, int y, int height, int width, GameFrame gf){
        this.image = image;
        this.x = x;
        this.y = y;
        this.height = height;
        this.width = width;
        this.gf = gf;
    }
    //画出图片
    public void paintSelf(Graphics g){
        g.drawImage(image, x, y, null);
    }
}
